import { getToken, setToken } from '@/utils/auth'

export default {
  namespaced: true,
  state: {
    token: getToken() || '',
    menu: [],
    activeUrl: ''
  },
  getters: {},
  mutations: {
    setToken (state, payload) {
      state.token = payload.token
      setToken(state.token)
    },
    setMenu (state, payload) {
      state.menu = payload.menu
    },
    setActiveUrl (state, payload) {
      if (payload.activeUrl === '/') {
        state.activeUrl = '/dashboard'
        return
      }
      state.activeUrl = payload.activeUrl
    }
  },
  actions: {}
}
